import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询流程模型列表
export function selectProcessBpmn(query) {
  return request({
    url: '/api/camunda/bpmn/list',
    method: 'get',
    params: query
  })
}

// 查询流程模型详细
export function selectProcessBpmnInfo(id) {
  return request({
    url: '/api/camunda/bpmn/' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增流程模型
export function insertProcessBpmn(data) {
  return request({
    url: '/api/camunda/bpmn',
    method: 'post',
    data: data
  })
}

// 修改流程模型
export function updateProcessBpmn(data) {
  return request({
    url: '/api/camunda/bpmn',
    method: 'put',
    data: data
  })
}

// 删除流程模型
export function deleteProcessBpmn(ids) {
  return request({
    url: '/api/camunda/bpmn/' + ids,
    method: 'delete'
  })
}

// 检查模型标识是否唯一
export function checkBpmnIdUnique(bpmnId) {
  return request({
    url: '/api/camunda/bpmn/checkBpmnIdUnique/' + parseStrEmpty(bpmnId),
    method: 'get'
  })
}

// 根据id获取模型文件
export function getBpmnFile(id) {
  return request({
    url: '/api/camunda/bpmn/getBpmnFile/' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增流程模型
export function saveBpmn(data) {
  return request({
    url: '/api/camunda/bpmn/saveBpmn',
    method: 'post',
    data: data
  })
}
